import request from '@/utils/request'
import qs from 'qs'
// 注册 api/register post
export const getRegister = (data) => request({ url: `/api/user/userRegister`, method: 'post', data: qs.parse(data) })

// 用户更新密码
export const updateUserPass = (data) => request({ url: `/api/user/updateUserpassword`, method: 'post', data })

// 用户登入 /api/login post
export const login = (data) => request({ url: '/api/user/loginGetToken', method: 'post', data })

// 获取个人信息 /api/personinfo/getUserInfo get
export const getUserInfo = () => request({ url: `/api/user/getUserInfo`, method: 'get' })

// 修改用户信息 /api/user/login/updateUserInfo post 有参数
export const changUserInfo = (data) => request({ url: `/api/user/updateUserInfo`, method: 'post', data })

// 获得用户个人课程 /api/home/getclass get
export const getUserClassList = (page, size) => request({ url: `/api/home/getclass?page=${page}&size=${size}`, method: 'get' })

// 搜索or获取消费记录 /api/home/searchRecord
export const getOrFindUserConsumeList = (data) => request({ url: `/api/personinfo/getOneclassinfo`, method: 'post', data })

// 获得个人收藏 /api/personinfo/getPersoninfo
export const getUserCollectClass = (data) => request({ url: `/api/personinfo/getPersoninfo`, method: 'post', data })

// 获得课程状态码 /api/personinfo/getstate
export const getClassState = () => request({ url: '/api/personinfo/getstate', method: 'get' })

// 学习记录 /api/personinfo/studyrecord
export const getStudyRecord = (page, size) => request({ url: `/api/personinfo/studyrecord?page=${page}&size=${size}`, method: 'get' })

